<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        let arr = [0,1,2,3,4,5]
        for (let index = 0; index < array.length; index++) {
            console.log(arr[index]);
            
            
        }
        // for in循环   可以获取到数组的下标
        for(let index in arr){
            console.log(index);
            // console.log(arr[index]);      
        }
        // for of循环    获取到数组中的每一个元素
        for(let item of arr){
            console.log(item);   
        }


        // 数组的高阶方法
        arr.forEach(item=>console.log(item));
        arr.forEach(function(item){
            console.log(item);
            
        })

        function  forEach(fun){
            for (let index = 0; index < array.length; index++) {
                const element = array[index];
                
            }
            return
        }
    </script>
</body>
</html>